$OpenBSD: patch-lex_c,v 1.7 2017/05/12 20:27:25 naddy Exp $

Index: lex.c
--- lex.c.orig
+++ lex.c
@@ -34,6 +34,8 @@
 #include <signal.h>
 #include <setjmp.h>
 #include <ctype.h>
+#include <unistd.h>
+#include <math.h>
 #include "sc.h"
 
 #ifdef NONOTIMEOUT
@@ -107,7 +109,7 @@ int
 yylex()
 {
     char *p = line + linelim;
-    int ret;
+    int ret = 0;
     static int isfunc = 0;
     static bool isgoto = 0;
     static bool colstate = 0;
@@ -326,7 +328,7 @@ plugin_exists(char *name, int len, char *path)
 	strcpy((char *)path, HomeDir);
 	strcat((char *)path, "/.sc/plugins/");
 	strncat((char *)path, name, len);
-	if (fp = fopen((char *)path, "r")) {
+	if ((fp = fopen((char *)path, "r"))) {
 	    fclose(fp);
 	    return 1;
 	}
@@ -334,7 +336,7 @@ plugin_exists(char *name, int len, char *path)
     strcpy((char *)path, LIBDIR);
     strcat((char *)path, "/plugins/");
     strncat((char *)path, name, len);
-    if (fp = fopen((char *)path, "r")) {
+    if ((fp = fopen((char *)path, "r"))) {
 	fclose(fp);
 	return 1;
     }
@@ -642,7 +644,7 @@ nmgetch() 
 
 #endif
 
-#if defined(SYSV2) || defined(SYSV3) || defined(MSDOS)
+#if defined(SYSV2) || defined(SYSV3) || defined(MSDOS) || defined(NCURSES_VERSION)
 
 void
 initkbd()
